﻿<#import "../../_layout.ftl" as layout>
${Html.s("pagetitle","完成任务")}
<@layout._layout>
<!-- Latest compiled and minified CSS -->
<!-- 引入bootstrap样式 -->
 <link rel="stylesheet" href="/content/bootstrap/css/bootstrap.min.css" crossorigin="anonymous">
 <link rel="stylesheet" href="/content/bootstrap/bootstrap-table/bootstrap-table.min.css">
    

<!-- Latest compiled and minified JavaScript -->
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="/content/jquery/3.2.1/jquery.min.js"></script>
 
<!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
<script src="/content/popper/1.15.0/umd/popper.min.js"></script>

<script src="/content/bootstrap/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script src="/content/bootstrap/bootstrap-table/bootstrap-table.min.js"></script>
<!-- Latest compiled and minified Locales -->
<script src="/content/bootstrap/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<div class="head">
    <div class="title">
    ${pagetitle}
    </div>
</div>
<style>
.search-colum{
width:260px;
float:left;
display:block;
margin:2px;
}
.search-colum label{
width: 60px;
}
.clear{
clear:both;
}
</style>
<div class="orderlist m10 myorder">
    <form action="#" method="post" id="searchForm">
        <div class="search">
        	<div class="search-colum"> <label>流程ID</label><input type="text" class="text midtext" style="width:150px;" name="flowId" id="flowId"   /></div>
            <div class="search-colum"> <label>任务ID</label><input type="text" class="text midtext" style="width:150px;" name="taskId" id="taskId"/></div>
            <div class="search-colum"> <label>流程标题</label><input type="text" class="text midtext" style="width:150px;" name="flowTitle"  id="flowTitle"/></div>
            <div class="search-colum"> <label>审批节点</label><input type="text" class="text midtext" style="width:150px;" name="flowApproveNode" id="flowApproveNode"/></div>
            <div class="search-colum"> <label>审批人</label><input type="text" class="text midtext" style="width:150px;" name="flowApproveBy" id="flowApproveBy"/></div>
            <div class="search-colum"> <label>发起人</label><input type="text" class="text midtext" style="width:150px;" name="createBy"  id="createBy"/></div>
            <div class="search-colum"> <input type="button"  class="btn1" onclick="customSearch();" value="搜索" accesskey="S"/></div>
            <div class="clear"></div>
          
        </div>
    </form>       

	<table id="table" class="table" width="100%">   
	</table>
  </div>
<script type="text/javascript">
	$(document).ready(function(){
		$('#table').bootstrapTable({
		  	  ajax:ajaxRequest,	
		  	  sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
  			  pagination: true,
  			  //customSearch: customSearch,
  			  queryParamsType:'undefind',
  			  striped: true,//设置为 true 会有隔行变色效果
  			  toolbar: "#searchForm",//指定工具栏
  			  queryParams :queryParam ,
			  columns: [{
			    field: 'id',
			    title: 'ID'
			  }, {
			    field: 'flowTitle',
			    title: '流程标题'
			  }, {
			    field: 'flowApproveNode',
			    title: '审批节点'
			  }, {
			    field: 'flowApproveBy',
			    title: '审批人'
			  }, {
			    field: 'taskState',
			    title: '任务状态',
			     formatter:function(value, item, index) {
			        if (value==1) {
			            return '待处理';
			        } else if (value==2) {
			           return '已处理';
			        } else if (value==3) {
			           return '已关闭';
			        }
			    }
			  }, {
			    field: 'updateTime',
			    title: '更新时间'
			  }, {
			    field: 'createTime',
			    title: '创建时间'
			  }, {
			    field: 'price7',
			    title: '操作',		
			    formatter:function(value,row,index){
			    	return ['<a href="/user/flow/task_detail?taskid='+row.id+'"	id="TabledView">查看</a>&nbsp;&nbsp;']
			    }
			  }]			
			});
	});
	function ajaxRequest(params) {
		$.ajax({
		 	url: '/user/flow/done_list',
		  	type:'POST',	
		  	dataType:"JSON",
		  	data:params.data,
		  	contentType: 'application/json',
		  	success:function(data){
		  		 params.success({"rows":data.data.data,"total":data.data.totalNum})
		  	
		  	},
		  	error:function(err){
		  		alert("加载数据失败");
		  	}
		});
	  			
	}
   function queryParam(params) {//上传服务器的参数
		var temp = {//如果是在服务器端实现分页，limit、offset这两个参数是必须的
				pageSize : params.pageSize, // 每页显示数量
				//pageIndex : params.offset, // SQL语句起始索引
				pageIndex: params.pageNumber,  //页码
	         	sortName:params.sortName,
	        	sortOrder:params.sortOrder,
	         	searchText:params.searchText,	 
				flowId : $("#flowId").val(),
				taskId : $("#taskId").val(),
				title : $("#flowTitle").val(),				
				approveNode : $("#flowApproveNode").val(),
				approveUserNo:${user.userno},
				approveBy : $("#flowApproveBy").val()
			};
		return JSON.stringify(temp);		
	}
	function clearfun(){
	   	 $('#flowId').val("");
	   	 $('#taskId').val("");
		 $('#flowApproveNode').val("");
		 $('#flowApproveBy').val("");					
		 $('#flowTitle').val("");		
    	 customSearch();

	}
	function customSearch(){
		$("#table").bootstrapTable('refresh');
	}  
</script>
</@layout._layout>

  
  